﻿<Page x:Class="MediaLibrary.SearchPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SearchPage">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="250" MinWidth="250" MaxWidth="250" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="28" />
            <RowDefinition x:Name="row1" />
        </Grid.RowDefinitions>

        <Label Grid.Column="0" FontSize="14" Padding="6, 2, 0, 0" Foreground="White" Background="Black" Height="26" VerticalAlignment="Top">Results</Label>

        <ListView x:Name="resultsListView"
            Grid.Row="1"
            Padding="6" 
            Foreground="White"
            Background="Black" 
            BorderThickness="0" 
            BorderBrush="Transparent" 
            ItemContainerStyle="{DynamicResource selectedStyle}"
            SelectionChanged="resultsListView_SelectionChanged">

            <ListView.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Add to Now Playing" Click="addToNowPlayingResult_OnClick" />
                    <MenuItem Header="Replace now playing with selection" Click="replaceNowPlayingResult_OnClick" />
                    <Separator />
                    <MenuItem Header="Playlists">
                        <MenuItem Header="Add to New Playlist" Click="addToNewPlaylistResult_OnClick" />
                        <MenuItem Header="Add to Playlist" Click="addToPlaylistResult_OnClick" />
                    </MenuItem>
                </ContextMenu>
            </ListView.ContextMenu>
        </ListView>

        <GridSplitter ResizeDirection="Columns" Grid.RowSpan="2" Grid.Column="0" Width="3" IsEnabled="False" Background="Gray" IsTabStop="False" />
        
        <Rectangle 
            Grid.Row="1"
            Grid.Column="1" 
            Width="{Binding playlistColumn.Width}" 
            Height="{Binding playlistColumn.Height}" 
            Opacity=".8"
            StrokeThickness="4"
            Fill="Black">
        </Rectangle>

        <Menu Grid.Row="0" Grid.Column="1" Width="{Binding playlistColumn.Width}" Padding="0, 0, 0, 0" Background="Black" VerticalAlignment="Top" Height="26" Foreground="White">
            <MenuItem Header="Detailed Search Results" Foreground="White" FontSize="14">
                <MenuItem Header="Select" Foreground="Black">
                    <MenuItem Header="Select All" Click="selectAllMenuItem_OnClick" Foreground="Black" />
                    <MenuItem Header="Invert Selection" Click="invertSelectionMenuItem_OnClick" Foreground="Black" />
                    <MenuItem Header="Clear Selection" Click="clearSelectionMenuItem_OnClick" Foreground="Black" />
                </MenuItem>
                <Separator />
                <MenuItem Header="Sort by..." Foreground="Black">
                    <MenuItem Header="Title" Click="sortByTitleMenuItem_OnClick" Foreground="Black" />
                    <MenuItem Header="Path and Filename" Click="sortByPathMenuItem_OnClick" Foreground="Black" />
                    <Separator />
                    <MenuItem Header="Randomize List" Click="randomizeMenuItem_OnClick" Foreground="Black" />
                    <MenuItem Header="Reverse List" Click="reverseListMenuItem_OnClick" Foreground="Black" />
                </MenuItem>
            </MenuItem>
        </Menu>
            
        <ListView x:Name="detailedResultsListView" 
            Grid.Row="1" 
            Grid.Column="1"
            SelectionMode="Extended" 
            ScrollViewer.CanContentScroll="False" 
            Background="Transparent"
            BorderBrush="Transparent"
            BorderThickness="0" 
            Padding="0 0 0 0"
            Height="{Binding Path=row1.Height-30}"
            ScrollViewer.HorizontalScrollBarVisibility="Auto"
            ItemContainerStyle="{DynamicResource selectedStyle}"
            MouseDoubleClick="detailedResultsListView_MouseDoubleClick">
            <ListView.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Add to Now Playing" Click="addToNowPlayingDetailedResult_OnClick" />
                    <MenuItem Header="Replace now playing with selection" Click="replaceNowPlayingDetailedResult_OnClick" />
                    <Separator />
                    <MenuItem Header="Playlists">
                        <MenuItem Header="Add to New Playlist" Click="addToNewPlaylistDetailedResult_OnClick" />
                        <MenuItem Header="Add to Playlist" Click="addToPlaylistDetailedResult_OnClick" />
                    </MenuItem>
                </ContextMenu>
            </ListView.ContextMenu>
        </ListView>
    </Grid>
</Page>
